<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 浅拷贝，把对象第一层的的属性和值，拷贝给另外一个对象
    let obj1={title:'aaaaaa',subject:'前端'}

    // ------------直接赋值-----------------------------
    // let obj2 = obj1 //(直接赋值，赋值的是地址)
    // obj2.title ='bbbbb'    //直接赋值obj1也改了
    // console.log(obj1,obj2)

    //------------浅拷贝-------------------------
    let obj2 = {...obj1}    //展开运算符
    obj2.title='bbbbb'
    console.log(obj1,obj2)
  </script>
</body>
</html>